package com.example.zdxk.mapper.primary;
import com.example.zdxk.entity.Location;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LocationMapper {

    // @Select("SELECT * FROM dc_terminfo")
   // public List<Location> getTerminfoList(String term_imei);

    @Insert("insert into dc_location(term_imei,location_lat,location_lng,location_time,location_name,location_type,batvalue) values(#{term_imei}, #{location_lat},#{location_lng},#{location_time},#{location_name},#{location_type},#{batvalue})")
    public int add(Location location);
    @Select("SELECT * FROM DC_LOCATION WHERE  id=(select max(id) from DC_LOCATION WHERE term_imei = #{term_imei})")
    public Location getlocation(String term_imei);
    @Select("select * from DC_LOCATION WHERE term_imei = #{0} limit #{1},#{2}")
    public List<Location> getLocationList(String term_imei, int page, int limit);
    @Select("select * from DC_LOCATION WHERE term_imei = #{term_imei}")
    public List<Location> getLocationcount(String term_imei);


}
